<HTML> 
<HEAD> 
	<TITLE>3rd Party ROBOTC Drivers</TITLE> 
<link href="tabs.css" rel="stylesheet" type="text/css"/> 
<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
</HEAD> 
 
<BODY bgcolor="#ffffff" link="#000000" vlink="#000000"> 
<table width="100%" bgcolor="navy" cellspacing=0 cellpadding=1 border=0> 
<tr><td><table width="100%" bgcolor="#EEEEDD" cellspacing=0 cellpadding=3 border=0> 
<tr> 
    <td width="33%" align="left"> <img src="images/LOGO_NXT.gif" width=266 height=44 border="0" alt="Mindstorms"></td> 
    <td><b><font size="+3" color="navy">3rd Party ROBOTC Drivers</font></b></td> 
    <td align="right"> <img src="images/logo.png" width=44 height=44 border="0" alt="RobotC"></td>     
</tr> 
  <tr bgcolor="#cccc99" align="right"> 
          <td colspan=3> <font face="arial" size="-1"> [<a href=main.html>Home</a>] [<a target=_top href="https://sourceforge.net/projects/rdpartyrobotcdr/">Download</a>] [<a target=_top href="http://apps.sourceforge.net/mantisbt/rdpartyrobotcdr/my_view_page.php">Submit a bug/suggestion</a>]  [<a target=_top href="http://www.robotc.net/forums/">ROBOTC Forums</a>] [<a target=_top href="http://botbench.com">Blog</a>] [<a target=_top href="http://sourceforge.net/donate/index.php?group_id=257238">Support this project</a>]</font> </td> 
</tr> 
</table></td></tr> 
</table> 
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<h1>common.h File Reference</h1>  </div>
</div>
<div class="contents">

<p>Commonly used functions used by drivers.  
<a href="#_details">More...</a></p>
<code>#include &quot;firmwareVersion.h&quot;</code><br/>

<p><a href="common_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga516e1f8e9479cb339afb3cb1cffdc536">__COMMON_H_SENSOR_CHECK__</a>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gaf80235eb257dc97cb46655fde261602e">MAX_ARR_SIZE</a>&#160;&#160;&#160;17</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gaaff7fb3e43cf77514fd0fec17012e360">min2</a>(a, b)&#160;&#160;&#160;(a &lt; b ? a : b)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gab1e1ffb6aa15887fa3bda4cfdef1f53a">min3</a>(a, b, c)&#160;&#160;&#160;(a &lt; b) ? ((a &lt; c) ? a : c) : ((b &lt; c) ? b : c)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga59934691af1d56f6e8f6d46c781bbcb5">max2</a>(a, b)&#160;&#160;&#160;(a &gt; b ? a : b)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gaa0d45e1e67c5cacf5c9251fcd90a971b">max3</a>(a, b, c)&#160;&#160;&#160;(a &gt; b) ? ((a &gt; c) ? a : c) : ((b &gt; c) ? b : c)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga4090c86dbda268a45068c4413fba327d">clip</a>(a, b, c)&#160;&#160;&#160;min2(c, max2(b, a))</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gab9598be7202472dcf4870641fb2cff17">STRTOK_MAX_TOKEN_SIZE</a>&#160;&#160;&#160;20</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga88adde798b06bf51b3ce9c7ac49188b1">STRTOK_MAX_BUFFER_SIZE</a>&#160;&#160;&#160;50</td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef ubyte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> [MAX_ARR_SIZE]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef sbyte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gab1288856582274ecffe7a7a3c8b2e7d9">tsByteArray</a> [MAX_ARR_SIZE]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef ubyte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gaf1da7edf6615d1b2376642de9bbfe449">tMassiveArray</a> [128]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef ubyte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gacc2928041c5ff8e7f2ddef1e88431e80">tHugeByteArray</a> [64]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef ubyte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga54b6c60d5d8ec411391ca920bf8dc97b">tBigByteArray</a> [32]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef ubyte&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga1c5690729eb47d01453399497a2b3029">tIPaddr</a> [4]</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga79eb917b5a56f0d0e7cf94886c6ac25c">tIntArray</a> [MAX_ARR_SIZE]</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gae58f52c19f82a79aedfdf5b9b3594abd">clearI2CError</a> (tSensors link, ubyte address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga1079ea93c9d0a5b793ea18ea2144ae7b">clearI2Cbus</a> (tSensors link)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga4fa55ac307e9bb34f74514371f527119">waitForI2CBus</a> (tSensors link)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gad02e06f83b264ee6fc7df41eb4712080">writeI2C</a> (tSensors link, <a class="el" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;request, <a class="el" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;reply, int replylen)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga98b9f725d95cc626af27f4660a8cddbe">writeI2C</a> (tSensors link, <a class="el" href="group__common.html#gaa172ef131853460e5b9f5c6db81d30f4">tByteArray</a> &amp;request)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#gaa2aa3061fe3c887f10977ce6feed3031">getUID</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__common.html#ga978c9ed56c6fce3d8d46f2cdca59b07e">strtok</a> (char *buffer, char *token, char *seperator)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Commonly used functions used by drivers. </p>
<p><a class="el" href="common_8h.html" title="Commonly used functions used by drivers.">common.h</a> provides a number of frequently used functions that are useful for writing drivers. License: You may use this code as you wish, provided you give credit where its due.</p>
<p>THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.</p>
<p>Changelog:</p>
<ul>
<li>0.1: Initial release</li>
<li>0.2: Added version check to issue error when compiling with RobotC &lt; 1.46</li>
<li>0.2: Added __COMMON_H_DEBUG__ to enable/disable sounds when an I2C error occurs</li>
<li>0.2: Removed bool waitForI2CBus(tSensors link, bool silent)</li>
<li>0.3: <a class="el" href="group__common.html#gae58f52c19f82a79aedfdf5b9b3594abd">clearI2CError()</a> added to make writeI2C more robust, I2C bus errors are now handled better.</li>
<li>0.4: Added HiTechnic SMUX functions</li>
<li>0.5: Added clip function (Tom Roach)</li>
<li>0.6: clearI2CBus is now conditionally compiled into the FW. Only RobotC &lt; 1.57 needs it.</li>
<li>0.7: ubyteToInt(byte byteVal) modified, works better with 1.57+</li>
<li>0.8: ubyte used for arrays for firmware version 770 and higher<br/>
 added support for new colour sensor<br/>
 added better handling for when sensor is not configured properly</li>
<li>0.9: added bool HTSMUXsetMode(tSensors link, byte channel, byte mode) prototype<br/>
 added int <a class="el" href="group__htsmux.html#ga97b638b1fcdd530bd49661013ce2d4a1">HTSMUXreadAnalogue(tMUXSensor muxsensor)</a><br/>
 added HTSMUXSensorType <a class="el" href="group__htsmux.html#ga5c27e1b6045663f1ad101bb44d773919">HTSMUXreadSensorType(tMUXSensor muxsensor)</a><br/>
 added bool <a class="el" href="group__htsmux.html#ga9bdbbe2647d372774e595c5f4d2df8cf">HTSMUXreadPort(tMUXSensor muxsensor, tByteArray &amp;result, int numbytes, int offset)</a><br/>
 added bool HTSMUXreadPort(tMUXSensor muxsensor, tByteArray &amp;result, int numbytes)<br/>
 added bool <a class="el" href="group__htsmux.html#gab9138a5f31c9bc88d36ae1afcec08bbf">HTSMUXsetMode(tMUXSensor muxsensor, byte mode)</a><br/>
 added bool <a class="el" href="group__htsmux.html#ga8bfdff9424179e6e1e7103a14e44c05c">HTSMUXsetAnalogueActive(tMUXSensor muxsensor)</a><br/>
 added bool <a class="el" href="group__htsmux.html#gadf42695ce182bb940e3cf966c82d4403">HTSMUXsetAnalogueInactive(tMUXSensor muxsensor)</a><br/>
 corrected function description for <a class="el" href="group__htsmux.html#ga10cd65e58344a5b8a7543463d23ef15e">HTSMUXSensorType()</a></li>
<li>0.10: Removed unnecessary read from <a class="el" href="group__htsmux.html#gab9fdda8b2a6ca3e637d831d62c20d857">HTSMUXsendCommand()</a></li>
<li>0.11: Added long uByteToLong(byte a1, byte a2, byte a3, byte a4);</li>
<li>0.12: Added <a class="el" href="group__htsmux.html#gaef01450d36623d782b4bf1ad4f964246">HTSMUXreadPowerStatus(tSensors link)</a><br/>
 Added int round(float fl)</li>
<li>0.13: Added motor mux types and data structs</li>
<li>0.14: Added check for digital sensors to prevent conflict with built-in drivers<br/>
 Changed clearI2CError to take ubyte for address, thanks Aswin</li>
<li>0.15: Removed motor mux and sensor mux functions and types out</li>
<li>0.16: Added max() and min() functions by Mike Henning, Max Bareiss</li>
</ul>
<dl class="author"><dt><b>Author:</b></dt><dd>Xander Soldaat (xander_at_botbench.com) </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>27 April 2011 </dd></dl>
<dl class="version"><dt><b>Version:</b></dt><dd>0.16 </dd></dl>

<p>Definition in file <a class="el" href="common_8h_source.html">common.h</a>.</p>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Mar 13 2013 19:56:43 for ROBOTC Drivers by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
